<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"> 
    <h:head>
        <title>Group Buying Search</title>
                <style type="text/css">
 body {
margin-left: 100px;
margin-top: 80px;
margin-right: 100px;
margin-bottom: 0px;

}
                  
        </style>
    </h:head>
    <h:body>
        <p:breadCrumb>  
            <p:menuitem value="" url="index.xhtml" />
            <p:menuitem value="Table Booking" url="TableBooking.xhtml" />  
            <p:menuitem value="Non-Deliverable Meal Purchase" url="MealPurchase.xhtml" />  
            <p:menuitem value="Deliverable Meal Purchase" url="deliverableMealPurchase.xhtml" />  
                        <p:menuitem value="Group Buying Item" url="GroupBuying.xhtml"/>

        </p:breadCrumb><br/><br/>
        <h:form prependId="false">  

            <p:dataGrid var="gbItem" value="#{groupBuyCustManagedBean.availableItems}" columns="3"  
                        rows="12" paginator="true" effect="true"  
                        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                        rowsPerPageTemplate="9,12,15"
                        >  

                <p:column>  
                    <p:panel header="#{gbItem.name}" 
                             footer="Discount: -#{groupBuyCustManagedBean.calculateDiscount(gbItem)}%"
                             style="text-align:center">  
                        <h:panelGrid columns="1" style="width:100%">  

                            <h:outputText value="#{gbItem.description}" />  

                            <p:commandButton value ="discover more about the deal"
                                             action ="GroupBuyingItemPage?faces-redirect=true">  
                                <f:setPropertyActionListener value="#{gbItem}"   
                                                             target="#{groupBuyCustManagedBean.selectedItem}" />  
                            </p:commandButton>
                        </h:panelGrid>  
                    </p:panel>  
                </p:column>  

            </p:dataGrid>  

        </h:form>  
    </h:body>
</html>

